$(function(){
	showCondition(true);
	//参数
	var drg = $("#tabContent > .tab-pane.active").data();
	paramTabPage[tabId] = drg;
	if(typeof(paramTabPage[tabId].previous)=="undefined"){
		$('#'+tabId+' #hosp-title').append(drg.title);
	}else{
		if(paramTabPage[tabId].previous=="mdc"){
			$('#'+tabId+' #hosp-title').append(drg.mdcCode+"指标");
		}else if(paramTabPage[tabId].previous=="adrg"){
			$('#'+tabId+' #hosp-title').append(drg.adrgCode+"指标");
		}else if(paramTabPage[tabId].monitorType=="depGroup"){
			$('#'+tabId+' #hosp-title').append(drg.depGroupName+"指标");
		}else if(paramTabPage[tabId].monitorType=="dep"){
			$('#'+tabId+' #hosp-title').append(drg.depName+"指标");
		}else if(paramTabPage[tabId].monitorType=="ward"){
			$('#'+tabId+' #hosp-title').append(drg.wardName+"指标");
		}else if(paramTabPage[tabId].monitorType=="clinic"){
			$('#'+tabId+' #hosp-title').append(drg.clinic_desc+"指标");
		}else if(paramTabPage[tabId].monitorType=="protomedicus"){
			$('#'+tabId+' #hosp-title').append(drg.protomedicus_desc+"指标");
		}else if(paramTabPage[tabId].monitorType=="physician"){
			$('#'+tabId+' #hosp-title').append(drg.physician_desc+"指标");
		}else if(paramTabPage[tabId].monitorType=="resident"){
			$('#'+tabId+' #hosp-title').append(drg.resident_desc+"指标");
		}
	}
	
	
	getQuotas("ywcDepLineAdrg", loadData,"drgs");
	
	function loadData(totalQuota){
		//科室组指标
		loadHospQuota(paramTabPage[tabId].monitorType,totalQuota,"hospQuotasId","ywcDepLineDrgTotal");
		
		if(drg.type == "dep"){
			// 自定义列，包括查询指标和 列定义
			var customCol = {"func":customColFun} ;
 			loadDRGsQuota(totalQuota,"DRG","depToDRGs#quotasId");
 			// 加载科室覆盖理论DRG
 			if(depdrgCodeIsTreatment == null) {
 				findDepartmentDRGs () ;
 			}
 		    loadDRGsQuotaData(totalQuota,"drgs",true,customCol,"ywcDepLineDrgDetail");
		} else {
			//加载指标的div
			loadDRGsQuota(totalQuota,"DRG","quotasId");
			// 加载指标数据
			loadDRGsQuotaData(totalQuota,"drgs",true,null,"ywcDepLineDrgDetail");
		}
	}
	// 自定义列数据 处理
	var customColFun =  function customColumns(columns){
		columns.splice(4,0,{"data": "isTreatment", 
     	   "render": function(obj, type, full){
     		   if(full["isTreatment"] == 0){
     			  return    "<font style=\"color:red\">否</font>" ;
     		   } else if(full["isTreatment"] == 1){
     			  return   "<font style=\"color:green\">是</font>" ;
     		   }
    	   }
       }) ;
	}
});


